<?php

if(!$l->isLoggedIn()) {
    setMission('?submit=apply');
    $l->main();
    return;
}

isset($_SESSION['step']) ? $step = $_SESSION['step'] : $step = 1;

if(isset($_POST['next']) || isset($_POST['pre'])) {
    if(isset($_POST['next'])) {
        set2session($_POST,$step);
        $step++;
        $_SESSION['step'] = $step;
    }
    if(isset($_POST['pre'])) {
        set2session($_POST,$step);
        $step--;
        $_SESSION['step'] = $step;
    }
}

if(isset($_POST['complete'])) {
	require_once("../lib/write2database.php");
}

switch ($step) {
    case 1:
        include_once 'personal.php';
        break;
    case 2:
        include_once 'study.php';
        break;
    case 3:
        include_once 'language.php';
        break;
    case 4:
        include_once 'period.php';
        break;
    case 5:
        include_once 'files.php';
        break;
    case 6:
        include_once 'priority.php';
        break;
    case 7:
        include_once 'overview.php';
        break;
}
?>
